﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
using DLL;
using Core;
using CommonHelpers;

namespace QuanLyBanLe
{
    public partial class FormOrder : Form
    {
        private ProductService m_ProductService;
        private ProductTypeService m_ProductTypeService;
        private ProducerService m_ProducerService;

        public FormOrder()
        {
            InitializeComponent();

            m_ProductService = new ProductService();
            m_ProductTypeService = new ProductTypeService();
            m_ProducerService = new ProducerService();

            m_Producers = m_ProducerService.GetProducers();
            Producer allProducer = new Producer();
            allProducer.Id = 0;
            allProducer.Name = "Tất cả";
            m_Producers.Insert(0, allProducer);

            m_ProductTypes = m_ProductTypeService.GetProductTypes();
            ProductType allProductType = new ProductType();
            allProductType.Id = 0;
            allProductType.Name = "Tất cả";
            m_ProductTypes.Insert(0, allProductType);

            InitOrderMan();
            InitReturnProductMan();
        }        

        private void FormOrder_Load(object sender, EventArgs e)
        {
            LoadOrderMan();
            LoadReturnProductWithBillMan();
            LoadReturnProductMan();
            this.Text += FormMain.GetShopInfo();
        }
        
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FormOrder_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (printing != null)
            {
                printing.Release();
            }
        }        
    }
}
